package de.vogella.android.listactivity;

import java.util.List;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.TextView;

public class MyAdapter extends ArrayAdapter<Grad> {

	private final List<Grad> list;
	private final Activity context;

	public MyAdapter(Activity context, List<Grad> list) {
		super(context, R.layout.mylayout, list);
		this.context = context;
		this.list = list;
	}

	static class ViewHolder {
		protected TextView text;
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		
		LayoutInflater inflater = context.getLayoutInflater();
		View rowView = inflater.inflate(R.layout.mylayout, null, true);
		TextView textView = (TextView) rowView.findViewById(R.id.label);
		textView.setText(list.get(position).getIme());

		return rowView;
	}
}
